﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace AlipayPay.Infrastructure.Api
{
    /// <summary>
    /// 响应消息
    /// </summary>
    public class ApiResult
    {
        public ApiResult()
        {

        }

        public ApiResult(int code, object data)
        {
            this.Code = code;
            this.Data = data;
        }

        /// <summary>
        /// 状态码
        /// </summary>
        [JsonProperty("code")]
        public int Code { get; set; }

        /// <summary>
        /// 响应消息
        /// </summary>
        [JsonProperty("response")]
        public object Data { get; set; }

        public static ApiResult Success(object data)
        {
            return new ApiResult(200, data);
        }

        public static ApiResult Success()
        {
            return new ApiResult(200, null);
        }

        public static ApiResult Fail(int statusCode, object data)
        {
            return new ApiResult(statusCode, data);
        }
    }
}
